package com.jml.config;

import java.util.ArrayList;
import java.util.List;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import springfox.documentation.swagger.web.SwaggerResource;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;

//网关配置swagger集群
//添加文档来源
@Component
@Primary
public class DocumentationConfig implements SwaggerResourcesProvider {
	@Override
	public List<SwaggerResource> get() {
		List resources = new ArrayList<>();
		// 第一个参数是随便自己写，第二个参数是/浏览器中输入的，就是在网关中配置的
		resources.add(swaggerResource("sui-bian-xie-member", "/api-member/v2/api-docs", "2.0"));
		resources.add(swaggerResource("sui-bian-xie-order", "/api-order/v2/api-docs", "2.0"));
		return resources;
	}

	private SwaggerResource swaggerResource(String name, String location, String version) {
		SwaggerResource swaggerResource = new SwaggerResource();
		swaggerResource.setName(name);
		swaggerResource.setLocation(location);
		swaggerResource.setSwaggerVersion(version);
		return swaggerResource;
	}
}


